package com.tadpole.music.adapter.me;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import androidx.annotation.NonNull;

import com.tadpole.music.R;
import com.tadpole.music.adapter.base.BaseAdapter;
import com.tadpole.music.bean.me.VipListBean;
import com.tadpole.music.holder.base.BaseViewHolder;
import com.tadpole.music.holder.me.MemberCenterViewHolder;

import java.util.List;

/**
 * 会员中心
 * Created By 孙岩
 * on 2020/9/11
 */
public class MemberCenterAdapter extends BaseAdapter {
    private Activity activity;
    private OnChildClickListener onChildClickListener;
    private MemberCenterViewHolder memberCenterViewHolder;
    private OnItemClickListener onItemClickListener;
    private List<VipListBean.DataBean> list;
    public MemberCenterAdapter(Activity activity,List<VipListBean.DataBean> list) {
        this.activity = activity;
        this.list = list;
    }

    @Override
    public BaseViewHolder createRelHolder(ViewGroup parent, int viewType) {
        memberCenterViewHolder = new MemberCenterViewHolder(activity,LayoutInflater.from(activity).inflate(R.layout.item_member_center, parent, false), onChildClickListener, onItemClickListener,list);
        return memberCenterViewHolder;
    }

    @Override
    public int getRelItemCount() {
        return list.size();
    }

    @Override
    public void setOnItemClickListener(OnItemClickListener listener) {
        this.onItemClickListener = listener;
    }

    @Override
    public void setOnChildClickListener(OnChildClickListener listener) {
        this.onChildClickListener = listener;
    }

    @Override
    public void setOnLongClickListener(OnLongClickListener listener) {

    }

    @Override
    public void onBindViewHolder(@NonNull BaseViewHolder holder, int position) {
        holder.init(position - mHeadViews.size());
    }
}
